<%@ Page Language="VB" Description="Component Test Program" Debug="True" %>
<%@ Import Namespace="SubBusinessClass" %>
<%@ Import Namespace="System.Data" %>

<html>
<script runat=server>
sub Page_Load(sender as Object, evtArgs as EventArgs)
	dim dsn as String = "server=localhost;uid=sa;pwd=;database=IBuyAdventure"
	dim pid as String = Request.Params("PID")
	if pid = "" then pid = "Boots"

	dim objProducts = new SubBusinessClass.SubIBAProducts()

	objProducts.DatabaseConnection = dsn

	dim products as DataSet = objProducts.GetProducts(pid)

	prodGrid.DataSource = products
	prodGrid.DataBind()

	avgPrice.Text = objProducts.AveragePrice(pid).ToString()
	
	newestProduct.Text = objProducts.GetNewestProduct(pid)
	
end sub

</script>

<body>

<h2>Average price for products in this category = <asp:Label runat="server" id=avgPrice /></h2>
<h2>Newest Product's ID is  = <asp:Label runat="server" id=newestProduct /></h2>

  <h3>List of Products</font></h3>

<asp:DataGrid id="prodGrid" runat="server" ShowHeader="False" >
</asp:DataGrid>

</body>
</html>
